<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录界面</title>
    <style>
        div{
            width:400px ;
            height: 400px;
            overflow: hidden;
            margin:100px auto;
        }
        p{
            width: 40px;
            height: 25px;
            text-align: center;
            line-height: 25px;
            border: 1px solid black;    
            margin:20px 60px;
            background-color: aqua;
        }
        p:hover{
            cursor: pointer;
        }
    </style>

    <script src="./jquery-3.5.0/jquery-3.5.0.js"></script>
    <script>
        $(function(){
            $('#login').on('click',function(){
                var username=$('#username').val();
                var password=$('#password').val();
                var obj={
                    password:password,
                    username:username
                }
                var baseUrl='http://123.57.30.43:7788';
                $.ajax({
                    type:'POST',
                    url:baseUrl+'/user/login',
                    contentType:'application/json;charset=utf-8',
                    data:JSON.stringify(obj),
                    success:function(data){
                        // console.log(data);
                        localStorage.setItem('token',data.data.token);
                        location.href='./智慧校园.html'; 
                    }
                })
            });            
        })
    </script>
</head>
<body>
    <div>
        用户名：<input type="text" id="username">
        <br>
        <br>
        密&nbsp&nbsp&nbsp&nbsp码：<input type="text" id="password">
        <br>
        <p id="login">登录</p>        
    </div>
</body>
</html>